<template>
  <div id="message-detail">
    <div class="items">
      <div class="item">
        <div class="header clearfix">
          <div class="left-side pull-left">
            <span class="number">{{detail.id}}</span>
            <span class="label">{{detail.label_top_name}}</span>
            <span class="label">{{detail.label_second_name}}</span>
          </div>
          <div class="right-side pull-right">{{detail.date}}</div>
        </div>
        <div class="content">{{detail.question}}</div>
        <div class="reply" v-show="detail.answer">
          <img src="../../assets/message.png" alt="">
          {{detail.answer}}
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getMessage } from '@/api/message'
import { parseTime } from '@/utils'

export default {
  data() {
    return {
      detail: ''
    }
  },
  mounted() {
    this.getdetail()
  },
  methods: {
    async getdetail() {
      const res = await getMessage(this.$route.params.id)
      const code = Number(res.code)
      if (code === 200) {
        this.detail = res.data
        this.detail.date = parseTime(res.data.create_time)
      }
    }
  }
}
</script>
<style lang="scss" scoped>
#message-detail{
  padding-right: 50px;
  .items{
    .header{
      padding-top: 35px;
      padding-left: 22px;
      .number{
        font-size: 18px;
        font-family: PingFangSC, PingFangSC-Semibold;
        font-weight: 600;
        text-align: left;
        color: rgba(0,0,0,0.85);
        line-height: 25px;
      }
      .label{
        margin-left: 16px;
        font-size: 14px;
        font-family: PingFangSC, PingFangSC-Regular;
        font-weight: 400;
        text-align: left;
        color: #fc7a01;
        line-height: 14px;
      }
      .right-side{
        font-family: PingFangSC, PingFangSC-Regular;
        font-weight: 400;
        text-align: left;
        color: rgba(0,0,0,0.45);
        line-height: 22px;
      }
    }
    .content{
      margin-top: 5px;
      padding-left: 50px;
      font-size: 14px;
      font-family: PingFangSC, PingFangSC-Regular;
      font-weight: 400;
      text-align: left;
      color: rgba(0,0,0,0.85);
      line-height: 25px;
      height: 75px;
      overflow:hidden;
      text-overflow:ellipsis;
      display:-webkit-box;
      -webkit-box-orient:vertical;
      -webkit-line-clamp:3;
    }
    .reply{
      position: relative;
      background: #f8fcff;
      border-radius: 2px;
      padding: 10px;
      padding-left: 50px;
      margin-left: 50px;
      height: 75px;
      color: rgba(0,0,0,0.65);
      overflow:hidden;
      text-overflow:ellipsis;
      display:-webkit-box;
      -webkit-box-orient:vertical;
      -webkit-line-clamp:3;
      img{
        position: absolute;
        left: 10px;
        top: 5px;
        width: 25px;
        height: 25px;
      }
    }
  }
}
</style>
